package sunwul.mall.auth.strategy.factory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sunwul.mall.auth.strategy.LoginStrategy;

import java.util.HashMap;
import java.util.Map;

/**
 * @author sunwul
 * @date 2024/12/26 15:16
 * @description 登录策略工厂
 */
@Component
public class LoginStrategyFactory {

    @Autowired
    private Map<String, LoginStrategy> loginStrategyMap = new HashMap<>();

    /**
     * 根据用户登录类型来获取具体的登录策略
     */
    public LoginStrategy getInstance(String loginType) {
        return loginStrategyMap.get(loginType);
    }
}
